import cv2
import numpy as np
from PIL import Image, ImageOps
import os

path='D:\\gluoncv\\gluoncv\\gluon\\data\\rotate'

for imname in os.listdir(path):
    im=cv2.imread(path+'\\'+imname)
    w=im.shape[1]
    h=int(im.shape[0]/2)

    left_pad = 0
    top_pad = 0
    right_pad = 0
    bottom_pad = 0

    padding = (left_pad, top_pad, right_pad, bottom_pad)
    im=cv2.resize(im,(w,h))
    #im=cv2.copyMakeBorder(im,0,0,w,0,cv2.BORDER_CONSTANT)

    cv2.imwrite('D:\\gluoncv\\gluoncv\\gluon\\data\\compress\\'+imname,im)


